home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-05 | 10.8 KB | 322 lines | [TEXT/PJMM] |
- { This file has been processed by The THINK Pascal Source Converter, v1.1. }
-
- {}
- {Created: Tuesday, January 29, 1991 at 6:35 PM}
- { Editions.p}
- { Pascal Interface to the Macintosh Libraries}
- {}
- { Copyright Apple Computer, Inc. 1989-1990}
- { All rights reserved}
- {}
-
-
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
-
- unit Editions;
- interface
- uses
- Types, Memory, OSUtils, Files, Dialogs, Appletalk, Aliases;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- const
-
- { resource types }
- rSectionType = 'sect'; { ResType of saved SectionRecords }
-
- { section types }
- stSubscriber = $01;
- stPublisher = $0A;
-
- sumAutomatic = 0; { subscriber update mode - Automatically }
- sumManual = 1; { subscriber update mode - Manually }
- pumOnSave = 0; { publisher update mode - OnSave }
- pumManual = 1; { publisher update mode - Manually }
-
- kPartsNotUsed = 0;
- kPartNumberUnknown = -1; { misc }
-
- kPreviewWidth = 120;
- kPreviewHeight = 120;
-
- kPublisherDocAliasFormat = 'alis';
- kPreviewFormat = 'prvw';
- kFormatListFormat = 'fmts';
-
- { bits for formatsMask }
- kPICTformatMask = 1;
- kTEXTformatMask = 2;
- ksndFormatMask = 4;
-
- { Finder types for edition files }
- kPICTEditionFileType = 'edtp';
- kTEXTEditionFileType = 'edtt';
- ksndEditionFileType = 'edts';
- kUnknownEditionFileType = 'edtu';
-
- { pseudo-item hits for dialogHooks }
- { the first if for NewPublisher or NewSubscriber Dialogs}
- emHookRedrawPreview = 150;
-
- { the following are for SectionOptions Dialog }
- emHookCancelSection = 160;
- emHookGoToPublisher = 161;
- emHookGetEditionNow = 162;
- emHookSendEditionNow = 162;
- emHookManualUpdateMode = 163;
- emHookAutoUpdateMode = 164;
-
- { the refcon field of the dialog record during a modalfilter }
- { or dialoghook contains one the following}
- emOptionsDialogRefCon = 'optn';
- emCancelSectionDialogRefCon = 'cncl';
- emGoToPubErrDialogRefCon = 'gerr';
- kFormatLengthUnknown = -1;
-
- type
- SectionType = SignedByte; { one byte, stSubscriber or stPublisher }
- TimeStamp = LONGINT; { seconds since 1904 }
- FormatType = packed array[1..4] of CHAR; { similar to ResType as used by scrap mgr }
- EditionRefNum = Handle; { used in Edition I/O }
- { update modes }
- UpdateMode = INTEGER; { sumAutomatic, pumSuspend, etc }
-
- SectionPtr = ^SectionRecord;
- SectionHandle = ^SectionPtr;
- SectionRecord = record
- version: SignedByte; { always 0x01 in system 7.0 }
- kind: SectionType; { stSubscriber or stPublisher }
- mode: UpdateMode; { auto or manual }
- mdDate: TimeStamp; { last change in document }
- sectionID: LONGINT; { app. specific, unique per document }
- refCon: LONGINT; { application specific }
- alias: AliasHandle; { handle to Alias Record }
- subPart: LONGINT; { which part of container file }
- nextSection: SectionHandle; { for linked list of app's Sections }
- controlBlock: Handle; { used internally }
- refNum: EditionRefNum; { used internally }
- end;
-
- EditionContainerSpecPtr = ^EditionContainerSpec;
- EditionContainerSpec = record
- theFile: FSSpec;
- theFileScript: ScriptCode;
- thePart: LONGINT;
- thePartName: Str31;
- thePartScript: ScriptCode;
- end;
-
- EditionInfoRecord = record
- crDate: TimeStamp; { date EditionContainer was created }
- mdDate: TimeStamp; { date of last change }
- fdCreator: OSType; { file creator }
- fdType: OSType; { file type }
- container: EditionContainerSpec; { the Edition }
- end;
-
- NewPublisherReply = record
- canceled: BOOLEAN; { O }
- replacing: BOOLEAN;
- usePart: BOOLEAN; { I }
- preview: Handle; { I }
- previewFormat: FormatType; { I }
- container: EditionContainerSpec; { I/O }
- end;
-
- NewSubscriberReply = record
- canceled: BOOLEAN; { O }
- formatsMask: SignedByte;
- container: EditionContainerSpec; {I/O}
- end;
-
- SectionOptionsReply = record
- canceled: BOOLEAN; { O }
- changed: BOOLEAN; { O }
- sectionH: SectionHandle; { I }
- action: ResType; { O }
- end;
-
-
- ExpModalFilterProcPtr = ProcPtr; { FUNCTION Filter(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
- ExpDlgHookProcPtr = ProcPtr; { FUNCTION Hook(itemOffset, item: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
-
- FormatIOVerb = (ioHasFormat, ioReadFormat, ioNewFormat, ioWriteFormat);
-
-
- FormatIOParamBlock = record
- ioRefNum: LONGINT;
- format: FormatType;
- formatIndex: LONGINT;
- offset: LONGINT;
- buffPtr: Ptr;
- buffLen: LONGINT;
- end;
-
-
- FormatIOProcPtr = ProcPtr; { FUNCTION IO(selector: FormatIOVerb; VAR PB: FormatIOParamBlock): OSErr; }
-
- EditionOpenerVerb = (eoOpen, eoClose, eoOpenNew, eoCloseNew, eoCanSubscribe);
-
-
- EditionOpenerParamBlock = record
- info: EditionInfoRecord;
- sectionH: SectionHandle;
- document: FSSpecPtr;
- fdCreator: OSType;
- ioRefNum: LONGINT;
- ioProc: FormatIOProcPtr;
- success: BOOLEAN;
- formatsMask: SignedByte;
- end;
-
-
- EditionOpenerProcPtr = ProcPtr; { FUNCTION Opener(selector: EditionOpenerVerb; VAR PB: EditionOpenerParamBlock): OSErr; }
-
- const
-
- { }
- { Section events now arrive in the message buffer using the AppleEvent format.}
- { The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary}
- { ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.}
- { The following is a sample buffer}
- { }
- { name offset contents}
- { ---- ------ --------}
- { }
- { header 0 'aevt'}
- { majorVersion 4 0x01}
- { minorVersion 6 0x01}
- { endOfMetaData 8 ';;;;' }
- { directObjKey 12 '----' }
- { paramType 16 'tid ' }
- { paramLength 20 0x0008 }
- { tempIDType 24 'sect' }
- { tempID 28 the SectionHandle <-- this is want you want}
-
- sectionEventMsgClass = 'sect';
- sectionReadMsgID = 'read';
- sectionWriteMsgID = 'writ';
- sectionScrollMsgID = 'scrl';
- sectionCancelMsgID = 'cncl';
-
- function InitEditionPack: OSErr;
- inline
- $3F3C, $0011, $303C, $0100, $A82D;
- function NewSection (container: EditionContainerSpec; sectionDocument: FSSpecPtr; kind: SectionType; sectionID: LONGINT; initalMode: UpdateMode; var sectionH: SectionHandle): OSErr;
- inline
- $303C, $0A02, $A82D;
- function RegisterSection (sectionDocument: FSSpec; sectionH: SectionHandle; var aliasWasUpdated: BOOLEAN): OSErr;
- inline
- $303C, $0604, $A82D;
- function UnRegisterSection (sectionH: SectionHandle): OSErr;
- inline
- $303C, $0206, $A82D;
- function IsRegisteredSection (sectionH: SectionHandle): OSErr;
- inline
- $303C, $0208, $A82D;
- function AssociateSection (sectionH: SectionHandle; newSectionDocument: FSSpecPtr): OSErr;
- inline
- $303C, $040C, $A82D;
- function CreateEditionContainerFile (editionFile: FSSpec; fdCreator: OSType; editionFileNameScript: ScriptCode): OSErr;
- inline
- $303C, $050E, $A82D;
- function DeleteEditionContainerFile (editionFile: FSSpec): OSErr;
- inline
- $303C, $0210, $A82D;
- function OpenEdition (subscriberSectionH: SectionHandle; var refNum: EditionRefNum): OSErr;
- inline
- $303C, $0412, $A82D;
- function OpenNewEdition (publisherSectionH: SectionHandle; fdCreator: OSType; publisherSectionDocument: FSSpecPtr; var refNum: EditionRefNum): OSErr;
- inline
- $303C, $0814, $A82D;
- function CloseEdition (whichEdition: EditionRefNum; successful: BOOLEAN): OSErr;
- inline
- $303C, $0316, $A82D;
- function EditionHasFormat (whichEdition: EditionRefNum; whichFormat: FormatType; var formatSize: Size): OSErr;
- inline
- $303C, $0618, $A82D;
- function ReadEdition (whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: univ Ptr; var buffLen: Size): OSErr;
- inline
- $303C, $081A, $A82D;
- function WriteEdition (whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: univ Ptr; buffLen: Size): OSErr;
- inline
- $303C, $081C, $A82D;
- function GetEditionFormatMark (whichEdition: EditionRefNum; whichFormat: FormatType; var currentMark: LONGINT): OSErr;
- inline
- $303C, $061E, $A82D;
- function SetEditionFormatMark (whichEdition: EditionRefNum; whichFormat: FormatType; setMarkTo: LONGINT): OSErr;
- inline
- $303C, $0620, $A82D;
- function GetEditionInfo (sectionH: SectionHandle; var editionInfo: EditionInfoRecord): OSErr;
- inline
- $303C, $0422, $A82D;
- function GoToPublisherSection (container: EditionContainerSpec): OSErr;
- inline
- $303C, $0224, $A82D;
- function GetLastEditionContainerUsed (var container: EditionContainerSpec): OSErr;
- inline
- $303C, $0226, $A82D;
- function GetStandardFormats (container: EditionContainerSpec; var previewFormat: FormatType; preview: Handle; publisherAlias: Handle; formats: Handle): OSErr;
- inline
- $303C, $0A28, $A82D;
- function GetEditionOpenerProc (var opener: EditionOpenerProcPtr): OSErr;
- inline
- $303C, $022A, $A82D;
- function SetEditionOpenerProc (opener: EditionOpenerProcPtr): OSErr;
- inline
- $303C, $022C, $A82D;
- function CallEditionOpenerProc (selector: EditionOpenerVerb; var PB: EditionOpenerParamBlock; routine: EditionOpenerProcPtr): OSErr;
- inline
- $303C, $052E, $A82D;
- function CallFormatIOProc (selector: FormatIOVerb; var PB: FormatIOParamBlock; routine: FormatIOProcPtr): OSErr;
- inline
- $303C, $0530, $A82D;
- function NewSubscriberDialog (var reply: NewSubscriberReply): OSErr;
- inline
- $303C, $0232, $A82D;
- function NewSubscriberExpDialog (var reply: NewSubscriberReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookProcPtr; filterProc: ExpModalFilterProcPtr; yourDataPtr: univ Ptr): OSErr;
- inline
- $303C, $0B34, $A82D;
- function NewPublisherDialog (var reply: NewPublisherReply): OSErr;
- inline
- $303C, $0236, $A82D;
- function NewPublisherExpDialog (var reply: NewPublisherReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookProcPtr; filterProc: ExpModalFilterProcPtr; yourDataPtr: univ Ptr): OSErr;
- inline
- $303C, $0B38, $A82D;
- function SectionOptionsDialog (var reply: SectionOptionsReply): OSErr;
- inline
- $303C, $023A, $A82D;
- function SectionOptionsExpDialog (var reply: SectionOptionsReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookProcPtr; filterProc: ExpModalFilterProcPtr; yourDataPtr: univ Ptr): OSErr;
- inline
- $303C, $0B3C, $A82D;
-
-
- { UsingEditions }
-
-
- implementation
- end.
-
-